<?php

// Check to ensure this file is included in Joomla!
defined('_JEXEC') or die( 'Restricted access' );

jimport( 'joomla.application.component.view');

class OrganizationViewCategory extends JView
{
	function display($tpl = null)
	{
		global $mainframe, $option;

		$db		=& JFactory::getDBO();
		$uri	=& JFactory::getURI();

		$filter_state		= $mainframe->getUserStateFromRequest( $option.'filter_state',		'filter_state',		'',				'word' );
		$filter_home		= $mainframe->getUserStateFromRequest( $option.'filter_home','filter_home','','word' );
		$filter_catid		= $mainframe->getUserStateFromRequest( $option.'filter_catid','filter_catid','','int' );
		$search				= $mainframe->getUserStateFromRequest( $option.'search',			'search',			'',				'string' );
		$search				= JString::strtolower( $search );

		// Get data from the model
		$items		= & $this->get( 'Data');
		$total		= & $this->get( 'Total');
		$pagination = & $this->get( 'Pagination' );

		// state filter
		$lists['state']	= JHTML::_('grid.state',  $filter_state, "Hiển thị","Không Hiển thị" );
		$javascript = 'onchange="document.adminForm.submit();"';
		
/*
		$query = 'SELECT c.id AS value, c.name AS text '
			. ' FROM #__detaicat AS c WHERE c.published = 1 '
			;
		$db->setQuery( $query );
		$catList[] = JHTML::_('select.option',  '0',JText::_( '--- Chọn Danh mục ---' ));
		$catList = array_merge( $catList, $db->loadObjectList() );		
		$lists['cat'] = JHTML::_('select.genericlist', $catList,'filter_catid', 'class="inputbox" '.$javascript, 'value', 'text',$filter_catid);
*/		
		// search filter
		$lists['search']= $search;

		$this->assignRef('items',		$items);
		$this->assignRef('lists',		$lists);
		$this->assignRef('pagination',	$pagination);

		parent::display($tpl);
	}
}